package com.app.view.loading 
{
	import com.greensock.TweenLite;
	import flash.display.MovieClip;
	import flash.filters.ColorMatrixFilter;
	import flash.text.TextField;
	
	import com.peachcastle.core.Display;
	
	import com.app.view.component.scene.HallScene;
	import com.app.view.component.scene.RoomScene;
	
	/**
	 * ...
	 * @author ...
	 */
	public class ConnectLoading extends Display
	{
		
		private var _txt:TextField = null;
		
		private var _showTween:TweenLite = null;
		public function ConnectLoading(ui:MovieClip = null) 
		{
			super(ui,true);
		}
		
		override protected function initialization():void 
		{
			super.initialization();
			
			_txt = assest["txt"];
			
			_txt.filters = [ new ColorMatrixFilter()];
			
		}
		
		public function showSocket(type:String = ""):void
		{
			super.showAssest();
			
			assest.alpha = 0;
			
			_showTween = TweenLite.to(assest, 1, { alpha:1 } );
			
			switch(type)
			{
				case HallScene.NAME:
				_txt.text = "正在鏈接大廳數據,請稍候...";
				break;
				case RoomScene.NAME:
				_txt.text = "正在鏈接房间數據,請稍候...";
				break;
			}
		}
		
		public function hide():void
		{
			if (_showTween)_showTween.kill();
			TweenLite.to(assest, 1, { alpha:0,onComplete:hideAssest}  );
		}
	}

}